-
-
Notifications
You must be signed in to change notification settings - Fork 19
Remove need for context in Sentry.init for Android #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one, LGTM!
sentry-kotlin-multiplatform/src/androidMain/AndroidManifest.xml
Outdated
Show resolved
Hide resolved
@BeforeTest | ||
open fun setUp() { | ||
// Set up the provider needed for Sentry.init on Android | ||
val provider = Robolectric.buildContentProvider(ContextProvider::class.java) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't know that one, nice!
...ltiplatform/src/androidUnitTest/kotlin/io/sentry/kotlin/multiplatform/ContextProviderTest.kt
Outdated
Show resolved
Hide resolved
* This does not allow for overriding the abstract query, insert, update, and delete operations | ||
* of the [ContentProvider]. | ||
*/ | ||
internal class ContextProvider : ContentProvider() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the default proguard rules already exclude any ContentProvider
classes from being obfuscated these days, but maybe worth double checking if the name is kept in a release build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, it's not obfuscated in the release build
Signed-off-by: Arnau Mora <[email protected]>
Ref #114
Eliminates the need for context in init - context can be passed in through a simple
ContextProvider
.